package com.example.listener.event;

import com.example.event.event.CustomEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/20 22:23
 */
@Slf4j
@Component
public class CustomListener implements ApplicationListener<CustomEvent> {
    @Override
    public void onApplicationEvent(CustomEvent customEvent) {
        //ApplicationEvent 可监听所有事件
        log.info("ApplicationListener 方式事件监听：{}",customEvent.getClass());
    }
}
